package cn.buk.api.ctrip.service;

import cn.buk.api.ctrip.dto.ApiOpResult;
import cn.buk.api.ctrip.dto.SearchPolicyCriteria;
import cn.buk.common.JsonResult;
import ctrip.api.flight.trade.common.commondata.v1.FdPolicySearchResponseType;
import ctrip.api.flight.trade.message.lowpricepolicy.v1.LowPricePolicyListType;
import ctrip.api.flight.trade.message.rawpolicy.v1.CommonPolicySummaryResponseType;
import ctrip.api.flight.trade.message.specialpolicy.v1.*;

import java.util.Date;
import java.util.List;

/**
 * Created by william on 2015-8-17.
 */
public interface CtripTradeQuickApiService {

    /**
     * 3.1.3	普通政策概要信息查询
     * @return
     */
    CommonPolicySummaryResponseType searchCommonPolicySummary(final String username, final String password, final String md5Password, SearchPolicyCriteria sc);

    int updateCommonPolicyPrice(final String username, final String password, final String md5password, long policyId, float returnPoint);

    int deleteCommonPolicy(final String username, final String password, final String md5password, long policyId);

    List<Long> searchCommonPolicyIdList(final String username, final String password, final String md5password);




    /**
     * 特殊政策 ID列表查询
     */
    List<Long> searchSpecialPolicyIdList(final String username, final String password, final String md5password, final int maxRow);

    /**
     * 特殊政策：ID列表查询(如果有POLICYCODE，则需要准确的）
     */
    List<Long> searchSpecialPolicyIdList(final String username, final String password, final String md5password, SearchPolicyCriteria sc);

    /**
     * 3.2.3	特殊政策概要信息查询
     * @return
     */
    SpecialPolicySummaryResponseType searchSpecialPolicySummary(final String username, final String password, final String md5password, SearchPolicyCriteria sc);

    /**
     * 3.2.5	特殊政策详细信息查询请求
     * @return
     */
    SpecialPolicyDetailSearchResponseType searchSpecialPolicyDetail(final String username, final String password, final String md5password, final long policyId);

    /**
     * 创建特殊政策
     * @param username
     * @param password
     * @param specialPolicyDetail
     * @return
     */
    SpecialPolicyAddResponseType createSpecialPolicy(final String username, final String password, final String md5password,
                                                     SpecialPolicyDetailType specialPolicyDetail);
    SpecialPolicyAddResponseType createSpecialPolicy(final String username, final String password, final String md5password,
                                                     List<SpecialPolicyDetailType> specialPolicyDetail);

    /**
     * 修改特殊政策
     * @param username
     * @param password
     * @param policyId
     * @param flightNo
     * @return
     */
    int updateSpecialPolicy(final String username, final String password, final String md5password, long policyId, Date effectDate, Date expiryDate, String days, String subclass, boolean isCanSale, final String flightNo);

    /**
     * 修改特殊政策的价格和有效性
     * @param username
     * @param password
     * @param policyId
     * @param newSetPrice
     * @param policyValid
     * @return
     */
    int updateSpecialPolicyPrice(final String username, final String password, final String md5password, long policyId, Float newSetPrice, Boolean policyValid);

    /**
     * 修改特殊政策的有效状态
     * @param username
     * @param password
     * @param md5password
     * @param policyId
     * @param policyValid
     * @return
     */
    JsonResult updateSpecialPolicyValidStatus(final String username, final String password, final String md5password, long policyId, Boolean policyValid);

    /**
     * 将指定航司，指定航线的特殊政策状态设置为指定值
     * @param username
     * @param password
     * @param md5password
     * @param dport
     * @param aport
     * @param carrier
     * @param policyValid
     * @return
     */
    JsonResult updateSpecialPoliciesValidStatus(final String username, final String password, final String md5password, String dport, String aport, String carrier, Boolean policyValid);

    /**
     * 修改多个特殊政策的有效状态
     * @param username
     * @param password
     * @param md5password
     * @param policyIds
     * @param policyValid
     * @return
     */
    JsonResult updateSpecialPolicyValidStatus(final String username, final String password, final String md5password, List<Long> policyIds, Boolean policyValid);

    SpecialPolicyChangePriceResponseType updateSpecialPolicyPrice(String username, String password, String md5password, List<SpecialPolicyPriceChangeType> changeList);


    ApiOpResult deleteSpecialPolicy(final String username, final String password, final String md5password, long policyId);
    ApiOpResult deleteSpecialPolicy(final String username, final String password, final String md5password, List<Long> policyIds);


    /**
     * 3.4.1	低价政策列表查询
     * 接口缓存查询：2000次/60秒
     * @return
     */
    String searchLowPricePolicyList0(final String username, final String password, final String md5password, String dport, String aport, Date ddate0, Date ddate1, String carrier, String subclass, int policyType);
    String searchLowPricePolicyList0(final String username, final String password, final String md5password, String dport, String aport, Date ddate0, Date ddate1, String carrier, String subclass, int policyType, int realTimeData, String productTypeType);
    List<LowPricePolicyListType> convertSearchLowPricePolicyListXml2Obj(String xml);
    List<LowPricePolicyListType> searchLowPricePolicyList(final String username, final String password, final String md5password, String dport, String aport, Date ddate0, Date ddate1, String carrier, String subclass, int policyType);

    /**
     * 低价政策列表查询
     * @param username
     * @param password
     * @param md5password
     * @param dport
     * @param aport
     * @param ddate0
     * @param ddate1
     * @param carrier
     * @param subclass
     * @param policyType
     * @param realTimeData
     * @param productType
     * @return
     */
    List<LowPricePolicyListType> searchLowPricePolicyList(final String username, final String password, final String md5password, String dport, String aport, Date ddate0, Date ddate1, String carrier, String subclass, int policyType, int realTimeData, final String productType);



    String searchPataSummary(final String username, final String password, final String md5password);

    SpecialPolicyDeleteResponseType deleteSpecialPolicyByPolicyCode(String username, String password, String md5password, String policyCode, boolean isFuzzy);

    /**
     * 搜索FD标准价
     * @param tbookingUsername
     * @param tbookingPassword
     * @param md5password
     * @param dcity
     * @param acity
     * @return
     */
    String searchFdPolicy(String tbookingUsername, String tbookingPassword, String md5password, String dcity, String acity);
    FdPolicySearchResponseType convertXml2FdPolicySearchResponseType(String xml);

}
